import java.util.ArrayList;

public class Offer56 {
    public int[] singleNumbers(int[] nums) {
        int result = 0;
        int x=0,y=0,m=1;
        for (int num : nums) {
            result^=num;
        }
        while ((result&m)==0){
            m<<=1;
        }
        for (int num : nums) {
            if ((num&m)!=0) x^=num;
            else y^=num;
        }
        return new int[]{x,y};

    }


    public static void main(String[] args) {
        Offer56 offer56 = new Offer56();
        int[] nums = new int[]{1,2,5,2};
        offer56.singleNumbers(nums);
    }
}
